/**
 * @author AM
 */

package no.hib.dat102;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import no.hib.dat102.adt.KoADT;

import org.junit.Before;
import org.junit.Test;


public class SirkulaerTabellADTTest {

	 /**
     * Storrelse paa test koen.
     */
    protected static final int SIZE = 10;

    // Koen
    private KoADT<Integer> ko;

    // Test data
    private Integer e0 = 1;
    private Integer e1 = 2;
    private Integer e2 = 3;
    private Integer e3 = 4;
    private Integer e4 = 5;
    private Integer e5 = 6;

    /**
     * Starter en ny ko for hver test.
     */
    @Before
    public final void setup()  {
        ko = new SirkulaerTabellKo<Integer>();
    }

    /**
     * Test om ny ko er tom.
     */
    @Test
    public final void nyKoErTom() {
        assertTrue(ko.erTom());
    }

    
    @Test
    public final void innKoutKoForste(){
    	ko.innKo(e1);
    	ko.innKo(e2);
    	ko.innKo(e3);
    	ko.innKo(e4);
    	ko.utKo();
    	ko.utKo();
    	
    	 assertEquals(e3, ko.forste());
    	
    }
    
    @Test
    public final void antallElementer(){
    	ko.innKo(e1);
    	ko.innKo(e2);

    	ko.utKo();
    	
    	// Tester antall elementer i koen
    	 assertEquals(1	, ko.storrelse());
	
}
    
    
    // Fjerne fra en tom ko
    @Test(expected=EmptyCollectionException.class)
    public final void fjerneFraEnTomKo() throws EmptyCollectionException{
       ko.utKo();
        
        }
   
  //Forventer feil
    @Test(expected=EmptyCollectionException.class)
    public final void tomForste() throws EmptyCollectionException{
//    	ko.innKo(e2);
       ko.forste();
        
        }
    
    
    
}
